All Questions
8 questions
2votes
1answer
100views
Most efficient way to find spatial order from a list of tuples (Python)
I have a circle-growth algorithm (line-growth with closed links) where new points are added between existing points at each iteration. The linkage information of each point is stored as a tuple in a ...
3votes
2answers
2kviews
Insert a number in a sorted list and return the list with the number at the correct index
I feel like the title is a bit wordy. What I have defined here is a function that takes two parameters: a list that contains valued sorted from smallest to biggest a number to insert at the right ...
1vote
1answer
1kviews
Recursive quicksort in Python
I want to find a more elegant way to build a recursive sorting function. The function randomly selects one of the numbers from a given list, k, and splits the list ...
4votes
1answer
2kviews
CLRS Exercise 2.3-4: Recursive Insertion Sort
I'm going through CLRS 3e and executing exercises to obtain a better understanding of CS fundamentals. Below is my solution to the following exercise from chapter 2: We can express insertion sort ...
5votes
4answers
5kviews
Recursive and iterative approach for mergesort
Problem: Question 8: * Mergesort is a type of sorting algorithm. It follows a naturally recursive procedure: Break the input list into equally-sized halves Recursively sort both ...
3votes
2answers
6kviews
Recursive functions for sorting
I made a few recursive functions for learning purposes which do a variety of tasks. Here is my current and functioning code: ...
2votes
3answers
2kviews
4votes
2answers
2kviews
How might we make this Python Merge Sort implementation more Pythonic?
I've implemented a (version of) Merge Sort algorithm in Python. My goal here is two-fold: Improve understanding of Merge Sort and recursion in a language agnostic way. Improve understanding of Python ...